package continuum.db.schema.embeddables;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Embeddable;

import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;
import org.jasypt.hibernate4.type.EncryptedDateAsStringType;
import org.jasypt.hibernate4.type.EncryptedStringType;

@Embeddable
@TypeDefs(value = {

		@TypeDef(name = "encryptedString", typeClass = EncryptedStringType.class, parameters = { @Parameter(name = "encryptorRegisteredName", value = "myHibernateStringEncryptor") }),
		@TypeDef(name = "encryptedDate", typeClass = EncryptedDateAsStringType.class, parameters = { @Parameter(name = "encryptorRegisteredName", value = "myHibernateStringEncryptor") })

})
public class SecurityDetails {

	@Type(type = "encryptedString")
	@Column(name = "user_username")
	private String username;

	@Type(type = "encryptedString")
	@Column(name = "user_password")
	private String password;

	@Type(type = "encryptedDate")
	@Column(name = "user_last_login")
	private Date lastLogin;

	@Type(type = "encryptedString")
	@Column(name = "user_roles")
	private String roles;

	@Column(name = "user_active")
	private boolean active;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Date getLastLogin() {
		return lastLogin;
	}

	public void setLastLogin(Date lastLogin) {
		this.lastLogin = lastLogin;
	}

	public String getRoles() {
		return roles;
	}

	public void setRoles(String roles) {
		this.roles = roles;
	}

	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}

}
